<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Validate DateBox - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
    <link rel="stylesheet" type="text/css" href="../demo.css">
    <script type="text/javascript" src="../../jquery.min.js"></script>
    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
<h2>Validate DateBox</h2>
<div class="demo-info">
    <div class="demo-tip icon-tip"></div>
    <div>When the selected date is greater than specified date. The field validator will raise an error.</div>
</div>
<div style="margin:10px 0;"></div>
<input class="easyui-datebox" required data-options="validType:'md[\'10/11/2012\']'"></input>
<script>
    $.extend($.fn.validatebox.defaults.rules, {
        md: {
            validator: function (value, param) {
                var d1 = $.fn.datebox.defaults.parser(param[0]);
                var d2 = $.fn.datebox.defaults.parser(value);
                return d2 <= d1;
            },
            message: 'The date must be less than or equals to {0}.'
        }
    })
</script>
</body>
</html>